Object: outputfield
The outputfield object is a custom type for use in Python scripts to represent an output field.
NOTE:
The name, value, quality, and timestamp properties of an output field are
"read only". Attempting to write directly to these properties
generates a runtime error.
However, the value, quality, and timestamp properties of an output field
can be written to with "set" methods.
Properties
|
Name |
Data type |
Description |
value |
int/double/string |
The value of the field. |
|
timestamp |
datetime.datetime |
The timestamp of the field. See the Important notes on field timestamps topic for details on timestamp format as well as upper and lower bounds on the timestamp. |
|
quality |
int |
The quality of the field. |
|
name |
string |
The name of the field. |
Methods
|
Name |
Return data type |
Description |
is_quality_good() |
boolean |
Returns True if the output field quality is good. Otherwise, returns False. |
|
is_quality_bad() |
boolean |
Returns True if the output field quality is bad. Otherwise, returns False. |
|
set_quality_good() |
void |
Sets the output field quality to good. |
|
set_quality_bad() |
void |
Sets the output field quality to bad. |
|
set_timestamp(timestamp) |
void |
Sets the output field timestamp, using a timestamp parameter. The parameter must be of type datetime.datetime. See the Important notes on field timestamps topic for details on timestamp format as well as upper and lower bounds on the timestamp. |
|
set( inputfield | outputfield | value [, timestamp [, quality]] ) |
void |
The set() method parameters can be any ONE of the following:
|
Accessing output fields
Output fields must be accessed via the outputs container.
Examples
The following examples illustrate checking output field quality.
Python: |
if inputs.MyInputField.is_quality_good(): # Take action because of good quality...
#or
if inputs.MyInputField.is_quality_bad(): # Take action because of bad quality...
|
The following examples illustrate several ways of using the set method on output fields.
Python: |
outputs.MyOutputField.set( 123.456 )
#or
outputs.MyOutputField.set( 123.456, now() )
#or
outputs.MyOutputField.set( inputs.MyInputField.value, inputs.MyInputField.timestamp, inputs.MyInputField.quality)
#or
outputs.MyOutputField.set( inputs.MyInputField )
|
Related topics: